const express = require('express')
const fs = require('fs')
const template = require('art-template')

const app = express()
app.get('/',(req,res)=>{
  const templateStr =  fs.readFileSync('./index.html','utf-8')
  // console.log(templateStr)
  const data = JSON.parse(fs.readFileSync('./data.json','utf-8'))
  // art-tempalte
  const html = template.render(templateStr,data)

  res.send(html)
})
app.get('/about',(req,res)=>{
  res.send(fs.readFileSync('./about.html','utf-8'))
})

app.listen('3000',()=>console.log('running'))